package com.zwd.cases.demo.gof23.strategy.cash;

/**
 * @Description 收费工厂类
 * @Author zhengwd
 * @Date 2023/4/12 14:55
 **/
public class CashFactory {

    /**
     * 初始化收费模式方法
     * @param type
     * @return
     */
    public static CashSuper createCashAccept(String type) {
        CashSuper cashSuper = null;
        switch (type) {
            case "正常收费":
                cashSuper = new CashNormal();
                break;
            case "打5折":
                cashSuper = new CashRebate(0.5);
                break;
            case "打8折":
                cashSuper = new CashRebate(0.8);
                break;
            case "满300返100":
                cashSuper = new CashReturn(300, 100);
                break;
            case "满500返200":
                cashSuper = new CashReturn(500, 200);
                break;
        }
        return cashSuper;
    }
}
